home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
404 Jogos
/
CLJG.iso
/
Aventura
/
FireMan.swf
/
scripts
/
frame_1055
/
PlaceObject2_530_133
/
CLIPACTIONRECORD onClipEvent(enterFrame).as
next >
Wrap
Text File
|
2008-09-12
|
4KB
|
144 lines
onClipEvent(enterFrame){
function doexplode()
{
myColor.setTransform(myColorNormal);
this.gotoAndStop("death");
}
function dorespawn()
{
currentdamage = 0;
hitted = false;
flashing = false;
timerdamage = 0;
death = false;
dx = 0;
this.gotoAndStop("standing");
idle = true;
descending = false;
attack = false;
_X = xi;
_Y = yi;
}
function drawframe()
{
!forward ? (_xscale = Math.abs(_xscale)) : (_xscale = Math.abs(_xscale) * -1);
this.gotoAndStop("standing");
}
xi -= heroe.scrollspeed;
_X = _X - heroe.scrollspeed;
yi -= heroe.vscrollspeed;
_Y = _Y - heroe.vscrollspeed;
_visible = false;
hitable = this.hitTest(_parent.mascara);
if(hitable)
{
_visible = true;
if(this.sprite.hotzone.hitTest(heroe.sprite.hotzone))
{
heroe.damage = 2;
heroe.hitted = true;
}
if(this.sprite.hotzone.hitTest(_parent.shoot1) && hitable)
{
hitted = true;
_root.shoot1.impact = true;
_root.hitted.start();
}
if(timerdamage == 0 && hitted)
{
timerdamage = FLASHTIME;
currentdamage += DAMAGE;
}
if(timerdamage > 0)
{
flashing = true;
timerdamage % 3 != 0 ? myColor.setTransform(myColorNormal) : myColor.setTransform(myColorTransform);
timerdamage--;
}
if(flashing && timerdamage == 0)
{
flashing = false;
myColor.setTransform(myColorNormal);
hitted = false;
}
if(currentdamage >= MAXDAMAGE)
{
myColor.setTransform(myColorTransform);
death = true;
delete shoot;
}
if(death)
{
_root.shoot1.impact = false;
doexplode();
dx = 0;
}
}
if(!death)
{
if(idle)
{
if(Math.abs(heroe._x - _X) <= 140 && _root.mascara.hitTest(_X,_Y))
{
attacking = false;
idle = false;
descending = true;
if(_X > heroe._x)
{
dx = SPEED;
forward = false;
}
else
{
dx = -1 * SPEED;
forward = true;
}
}
}
if(descending)
{
heroe.DAMAGE = 2;
dy = 3;
_Y = _Y + dy;
if(_Y >= heroe._y - heroe._height / 2 - 64 && heroe.vertical == 0)
{
dy = 0;
descending = false;
attack = true;
shoot = new Sound();
shoot.attachSound("mflyershoot");
if(_X > heroe._x)
{
dx = SPEED;
forward = false;
}
else
{
dx = -1 * SPEED;
forward = true;
}
}
}
if(attack && !attacking)
{
attacking = true;
this.attachMovie("bullet","b1",1);
this.attachMovie("bullet","b2",2);
shoot.start();
b1.control.dx = 2;
b1.control.dy = 2;
b1._x = -8;
b1._y += 13;
b2.control.dx = -2;
b2.control.dy = 2;
b2._x = 8;
b2._y += 13;
}
drawframe();
}
else if(!_root.mascara.hitTest(xi,yi) && !(b1._visible || b2._visible))
{
dorespawn();
}
}